﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MathLab.Utils
{
  class Vector
  {
    public string name {get; set;}
    public double[] vector { get; set; }
    /// <summary>
    /// Creating a new instance of class Vector
    /// </summary>
    /// <param name="sName">name of vector</param>
    /// <param name="dVector"> one-dimension array</param>
    public Vector(string sName, double[] dVector)
    {
      this.name = sName;
      this.vector = dVector;
    }

    public Vector()
    {
    }

    public static Vector operator +(Vector vectorA, Vector vectorB)
    {
      return new Vector(vectorA.name + "+" + vectorB.name, MatrixSum.Sum(vectorA.vector, vectorB.vector));
    }

    public static Matrix operator *(Vector vectorA, Vector vectorB)
    {
      return new Matrix(vectorA.name + "+" + vectorB.name, MatrixMultiply.Multiply(vectorA.vector, vectorB.vector));
    }

    public static Vector operator |(Vector vectorA, Vector vectorB)
    {
      return new Vector(vectorA.name + "|" + vectorB.name, VectorMultiply.ScalarMultiplyVector(vectorA.vector, vectorB.vector));
    }

    public static Vector operator *(Vector vector, double factor)
    {
      return new Vector(vector.name + "*" + factor.ToString(), MatrixFactorMultiply.FactorMultiply(vector.vector, factor));
    }

    public static Vector operator *(double factor, Vector vector)
    {
      return new Vector(factor.ToString() + "*" + vector.name, MatrixFactorMultiply.FactorMultiply(vector.vector, factor));
    }

  }
}
